package java67_18;

import java.util.Scanner;

import java67_17.jiekou.pc.SolidDisk;
import java67_17.jiekou.pc.USB;
import java67_17.jiekou.pc.USBFan;

public class Diannaocheng {
	public String name;

	// 卖usb设备
	// 1000元,买固态,100买鼠标,10买usb风扇,其他买不到
	public USB sell(int money) {
		if (money > 1000) {
			return new SolidDisk();
		} else if (money > 100) {
			return new USBMouse("罗技光电鼠");
		} else if (money > 10) {
			return new USBFan("扬子");
		}
		return null;
	}

	public static void main(String[] args) {
		Diannaocheng d = new Diannaocheng();
		d.name = "百脑汇";
		Scanner in = new Scanner(System.in);
		System.out.print("打算花多少钱:");
		USB usb = d.sell(in.nextInt());
		if (usb == null) {
			System.out.println("什么没买到");
			return;
		}
		System.out.println("买到了" + usb);
		usb.plug();
		usb.work();
	}
}
